package com.lagou.edu.service.impl;

import com.lagou.edu.service.EmailRpcService;
import com.lagou.edu.service.EmailService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

/**
 * @author mcl
 * @date 2021/8/20 2:45 下午
 * @description
 */
@Service
public class EmailRpcServiceImpl implements EmailRpcService {
    @Autowired
    private EmailService emailService;

    @Value("${config.email.templates.checkcode.title}")
    private String emailTitle;

    @Value("${config.email.templates.checkcode.content}")
    private String emailContent;
    @Override
    public Boolean sendMail(String email, String checkCode) {
        String message = String.format(emailContent, checkCode);
        return emailService.sendEmail(email, emailTitle, message);
    }
}
